<?php
function getFraisLivraison($q, $p, $s){
	$r = 0;
	/*if($q==1 && $p<1000){
		$r = getTarifCourrier($q, $p, $s);
	} else {
		$r = getTarifColis($q, $p, $s);
	}*/
	// Il n'y a plus de tarifs courrier
	$r = getTarifColis($q, $p, $s);
	return $r;
}
function getTarifColis($q, $p, $s){
	$p += 100;
	if($p<=500){
		$r = 5.95;
	} elseif($p<=1000){
		$r = 6.95;
	} elseif($p<=2000){
		$r = 7.95;
	} elseif($p<=3000){
		$r = 8.95;
	} elseif($p<=5000){
		$r = 10.95;
	} elseif($p<=7000){
		$r = 12.95;
	} elseif($p<=10000){
		$r = 15.95;
	} elseif($p<=15000){
		$r = 18.20;
	} else {
		$r = 24.90;
	}
	if($s){
		$r += 2.50;
	}
	return $r;
}

function format_price($price) {
	return number_format($price, 2, '.', '');
}
 
/*
function getTarifCourrier($q, $p, $s){
	if($p<=20){
		$r = 0.55;
	} elseif($p<=50){
		$r = 0.88;
	} elseif($p<=100){
		$r = 1.33;
	} elseif($p<=250){
		$r = 2.18;
	} elseif($p<=500){
		$r = 2.97;
	} elseif($p<=1000){
		$r = 3.85;
	} elseif($p<=2000){
		$r = 5.07;
	} elseif($p<=3000){
		$r = 5.93;
	} else {
		$r = 5.93;
	}
	if($s){
		$r += 2.80;
	}
	return $r;
}
*/
?>